<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Spring Security</title>
</head>

<body>

<div style="width: 300px;">
    <security:authentication var="user" property="principal" />
    <security:authorize access="isAnonymous()">
        <h2>Please sign in</h2>
    </security:authorize>
    <security:authorize access="isAuthenticated()">
        <h2>Logged in as ${user.username}</h2>
    </security:authorize>
    <form action="${pageContext.request.contextPath}/login/j_spring_security_check" method="post">
        <input type="text" name="j_username" placeholder="Email address" required autofocus value="main">
        <input type="password" name="j_password" placeholder="Password" required value="1234">
        <button type="submit">Войти</button>
    </form>

    <security:authorize access="isAuthenticated()">
        <a href="${pageContext.request.contextPath}/view/Admin.jsp">Admin</a>
        <a href="${pageContext.request.contextPath}/view/Client.jsp">Client</a>
    </security:authorize>

</div>
</body>
</html>